home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / comm / cnet / chkinbnd12b.lha / checkinbound next >
Text File  |  1994-06-22  |  12KB  |  541 lines

  1.  
  2.   
  3.   /*      Checkinbound 12   May 16,1994  by Charles Johnston 
  4.                Sysop - Upper Room BBS - (602) 771-8971  
  5.  
  6.      
  7.       ------------------------------------------------------------ 
  8.        Edit the variables below to suit YOUR system configuration 
  9.       ------------------------------------------------------------        */
  10.  
  11.  Faith = "1"         /* <----- "1" if you run Faith-Net  "0" if you don't */
  12.  
  13.  Clink = "1"         /* <----- "1" if you run Clink      "0" if you don't */
  14.  
  15.  Traptoss = "0"      /* <----- "1" if you use Traptoss   "0" if you don't */
  16.  
  17.  
  18.  DoImportPath="CNET:TOSS"  /* <-YOUR TOSSER script or command             */
  19.  
  20.  
  21.  Ticpath = "BIN:ftick mail:configs/tick.cfg" /* <-YOUR Tick prg path.     
  22.                                                   If none then put "0"    */
  23.  
  24.                                              
  25.  Trapcfgpath = "BIN:traplist.cfg"            /*<-YOUR Traplist.cfg path   */
  26.  
  27.  
  28.  OutDIR = "Mail:outbound/"  /* <--YOUR system's outbound directory path   */
  29.  
  30.  
  31.  PrgPath = "Bin:"  /* <-- the directory CheckInbound is commanded from  
  32.                            With Aftersession command use BIN:             */
  33.  
  34.  
  35.  FIDO = "2" /* <--You ARE NOT running FIDO now  then FIDO = "0"           */
  36.             /*    You ARE running FIDO on 68040 then FIDO = "1"           */
  37.             /*    You ARE running FIDO on 68030 then FIDO = "2"           */
  38.             /*    You ARE running FIDO on 68020 then FIDO = "3"           */
  39.             /*    You ARE running FIDO on 68000 then FIDO = "4"           */
  40.  
  41.  /* Note:
  42.     the FIDO variable sets a delay so Traplist can finish COMLETELY before
  43.     deletion of the old nodelists is attempted. If your OLD nodelists do 
  44.     not get deleted move the variable up in value. Tested on 030'/40 mhz      
  45.  
  46.      --------------------------------------------------------------
  47.                       T  H  A  N  K     Y  O  U 
  48.      --------------------------------------------------------------       */ 
  49.  
  50.  
  51. if ~show('l','rexxsupport.library') then;do
  52. if ~addlib('rexxsupport.library',0,-30,0) then;do
  53. say "Couldn''t access rexxsupport.library!"
  54. exit 5
  55. end
  56. end
  57. Options Results
  58. call checkzerobyte
  59. call checkzedzip
  60. InDir="Mail:Inbound/"
  61. InboundFiles=showdir(InDir,'F')
  62. if InboundFiles='' then EXIT
  63. ftic=0
  64. toss=0
  65. trap=0
  66. setclip('fa')
  67. setclip('c')
  68. setclip('fi')
  69. if faith="1" then
  70. do
  71. call checkfaitheco
  72. call checkfaithlst
  73. end
  74. if clink="1" then
  75. do
  76. call checkclinkeco
  77. call checkclinklst
  78. end
  79. if fido~="0" then
  80. do
  81. call checknodediff
  82. end
  83. call trap
  84. call Tic
  85. call toss
  86. if Traptoss="1" then
  87. do
  88. call checkbadmsgs
  89. end
  90. call WriteDelete
  91. call checkbakin
  92. Tic:
  93. InDir="Mail:Inbound/"
  94. InboundFiles=showdir(InDir,'F')
  95. DO i=1 TO WORDS(InboundFiles)
  96. testfile=WORD(InboundFiles,i)
  97. line=testfile
  98. parse var line name "." suffix rest
  99. if upper(suffix)='TIC' then ftic=1
  100. end i
  101. if ftic=1&Ticpath="0" then call deletetic
  102. if ftic=1&Ticpath ~="0" then
  103. do
  104. address command
  105. 'run >NIL:' Ticpath
  106. end
  107. call delay(14)
  108. RETURN
  109. Toss:
  110. InDir="Mail:Inbound/"
  111. InboundFiles=showdir(InDir,'F')
  112. DO i=1 TO WORDS(InboundFiles)
  113. testfile=WORD(InboundFiles,i)
  114. line=testfile
  115. parse var line name "." suffix rest
  116. msg=left(suffix,2)
  117. if upper(msg)=MO&length(suffix)=3 then
  118. do
  119. toss=1
  120. leave i
  121. end
  122. if upper(msg)=TU&length(suffix)=3 then
  123. do
  124. toss=1
  125. leave i
  126. end
  127. if upper(msg)=WE&length(suffix)=3 then
  128. do
  129. toss=1
  130. leave i
  131. end
  132. if upper(msg)=TH&length(suffix)=3 then
  133. do
  134. toss=1
  135. leave i
  136. end
  137. if upper(msg)=FR&length(suffix)=3 then
  138. do
  139. toss=1
  140. leave i
  141. end
  142. if upper(msg)=SA&length(suffix)=3 then
  143. do
  144. toss=1
  145. leave i
  146. end
  147. if upper(msg)=SU&length(suffix)=3 then
  148. do
  149. toss=1
  150. leave i
  151. end
  152. if upper(msg)=PK&length(suffix)=3 then
  153. do
  154. toss=1
  155. leave i
  156. end
  157. end i
  158. if toss=1 then
  159. do
  160. address command
  161. DoImportPath
  162. end
  163. call delay(5)
  164. RETURN
  165. checkzerobyte:
  166. address command
  167. 'SYS:c/list >ram:filelist LFORMAT "%-25N %L"' Outdir
  168. dirname=Outdir
  169. data='ram:filelist'
  170. call OPEN(f,data,'r')
  171. do while ~eof(f)
  172. line=readln(f)
  173. parse var line name size
  174. delfile=dirname||name
  175. if size='empty' then CALL delete(delfile)
  176. end
  177. call close(f)
  178. call delay(15)
  179. address command 'delete ram:filelist QUIET'
  180. RETURN
  181. checkbadmsgs:
  182. address command
  183. 'SYS:c/list >ram:msglist LFORMAT "%-25N %D" Mail:Bad/'
  184. dirname='Mail:Bad/'
  185. data='ram:msglist'
  186. call OPEN(f,data,'r')
  187. do while ~eof(f)
  188. line=readln(f)
  189. parse var line name day
  190. delfile=dirname||name
  191. if day ~='Today' then CALL delete(delfile)
  192. end
  193. call close(f)
  194. call delay(15)
  195. address command 'delete ram:msglist QUIET'
  196. return
  197. checkzedzip:
  198. address command
  199. 'SYS:c/list >ram:zedzip Mail:Inbound/'
  200. dirname='Mail:Inbound:'
  201. data='ram:zedzip'
  202. call OPEN(f,data,'r')
  203. do while ~eof(f)
  204. line=readln(f)
  205. parse var line name '.' suffix size rest
  206. if upper(suffix)='PKT'&size='60' then
  207. do
  208. delfile=dirname||name||'.'||suffix
  209. address command 'delete' delfile 'QUIET'
  210. end
  211. end
  212. call close(f)
  213. call delay(14)
  214. address command
  215. 'delete ram:zedzip QUIET'
  216. return
  217. deletetic:
  218. address command
  219. 'SYS:c/list >ram:ticlist Mail:Inbound/'
  220. dirname='Mail:Inbound/'
  221. data='ram:ticlist'
  222. call OPEN(f,data,'r')
  223. do while ~eof(f)
  224. line=readln(f)
  225. parse var line name '.' suffix rest
  226. delfile=dirname||name||'.'||suffix
  227. if upper(suffix)='TIC' then CALL delete(delfile)
  228. end
  229. call close(f)
  230. call delay(14)
  231. address command
  232. 'delete ram:ticlist QUIET'
  233. return
  234. checkbakin:
  235. dirname='Mail:BakIn/'
  236. If ~exists(dirname) then
  237. do
  238. setclip('fa')
  239. setclip('c')
  240. setclip('fi')
  241. EXIT
  242. end
  243. address command
  244. 'SYS:c/list >ram:bakin LFORMAT "%-15N %D" Mail:Bakin/'
  245. data='ram:bakin'
  246. call OPEN(f,data,'r')
  247. do while ~eof(f)
  248. line=readln(f)
  249. parse var line name day
  250. delfile=dirname||name
  251. if day ~='Today' then CALL delete(delfile)
  252. end
  253. call close(f)
  254. call delay(15)
  255. address command 'delete ram:bakin QUIET'
  256. EXIT
  257. trap:
  258. if trap=1 then
  259. do
  260. address command 'CD BIN:'
  261. address command 'run >NIL: traplist CONFIG' trapcfgpath
  262. if FIDO="0" then call delay(500)
  263. if FIDO="1"&getclip('fi')='NODEDIFF' then call delay(1500)
  264. if FIDO="1"&getclip('fi')='' then call delay(1100)
  265. if FIDO="2"&getclip('fi')='NODEDIFF' then call delay(3000)
  266. if FIDO="2"&getclip('fi')='' then call delay(1850)
  267. if FIDO="3"&getclip('fi')='NODEDIFF' then call delay(5000)
  268. if FIDO="3"&getclip('fi')='' then call delay(2850)
  269. if FIDO="4"&getclip('fi')='NODEDIFF' then call delay(7500)
  270. if FIDO="4"&getclip('fi')='' then call delay(4350)
  271. end
  272. RETURN
  273. WriteDelete:
  274. if getclip('c')='ClinkLST' then
  275. do
  276. filename='sysdata:log/maint'
  277. if ~exists(filename) then
  278. do
  279. call open(f,filename,'w')
  280. end
  281. call open(f,filename,'a')
  282. line=''
  283. call writeln(f,line)
  284. line='Updated Clink nodelist on' Date(u) 'at' Time(c)
  285. call writeln(f,line)
  286. line=''
  287. call writeln(f,line)
  288. call close(f)
  289. call delete(oldcfile)
  290. end
  291. if getclip('fa')='FaithLST' then
  292. do
  293. filename='sysdata:log/maint'
  294. if ~exists(filename) then
  295. do
  296. call open(f,filename,'w')
  297. end
  298. call open(f,filename,'a')
  299. line=''
  300. call writeln(f,line)
  301. line='Updated Faith-Net nodelist on' Date(u) 'at' Time(c)
  302. call writeln(f,line)
  303. line=''
  304. call writeln(f,line)
  305. call close(f)
  306. call delete(oldfafile)
  307. end
  308. if getclip('fi')='NODEDIFF' then
  309. do
  310. filename='sysdata:log/maint'
  311. if ~exists(filename) then
  312. do
  313. call open(f,filename,'w')
  314. end
  315. call open(f,filename,'a')
  316. line=''
  317. call writeln(f,line)
  318. line='Updated FIDO nodelist on' Date() 'at' Time(c)
  319. call writeln(f,line)
  320. line=''
  321. call close(f)
  322. address command 'delete' deldiff
  323. call delay(14)
  324. address command 'delete' delnode
  325. end
  326. RETURN
  327. checknodediff:
  328. InDir="Nodelist:"
  329. InboundFiles=showdir(InDir,'F')
  330. DO i=1 TO WORDS(InboundFiles)
  331. testfile=WORD(InboundFiles,i)
  332. line=testfile
  333. parse var line oldnode'.' oldnodenumbers rest
  334. if upper(oldnode)='NODELIST' THEN
  335. do
  336. delnode=InDir||oldnode||'.'||oldnodenumbers
  337. end
  338. end i
  339. InDir="Nodelist:"
  340. InboundFiles=showdir(InDir,'F')
  341. DO i=1 TO WORDS(InboundFiles)
  342. testfile=WORD(InboundFiles,i)
  343. line=testfile
  344. parse var line olddiff '.' olddiffnumbers rest
  345. if upper(olddiff)='NODEDIFF' THEN
  346. do
  347. deldiff=InDir||olddiff||'.'||olddiffnumbers
  348. end
  349. end i
  350. InDir="Inbound:"
  351. InboundFiles=showdir(InDir,'F')
  352. DO i=1 TO WORDS(InboundFiles)
  353. testfile=WORD(InboundFiles,i)
  354. line=testfile
  355. parse var line diffname '.' diffnumbers
  356. if upper(diffname)='NODEDIFF' THEN
  357. do
  358. trap=1
  359. setclip('fi','NODEDIFF')
  360. arcpath=InDir||diffname'.'diffnumbers
  361. address command 'arc x ' arcpath
  362. call delay(100)
  363. if ticpath="0" then
  364. do
  365. address command 'delete' InDir||'nodediff.#? QUIET'
  366. end
  367. address command 'rename' PrgPath||'Nodediff.#? Nodelist: QUIET'
  368. end
  369. end i
  370. call delay(14)
  371. close(f)
  372. RETURN
  373. checkclinklst:
  374. newcname=''
  375. InDir="Nodelist:"
  376. InboundFiles=showdir(InDir,'F')
  377. DO i=1 TO WORDS(InboundFiles)
  378. testfile=WORD(InboundFiles,i)
  379. line=testfile
  380. parse var line oldname '.' oldnumbers rest
  381. if upper(oldname)='CLINKLST' THEN
  382. do
  383. oldcname='ClinkLST'
  384. oldcfile=InDir||oldname||'.'||oldnumbers
  385. oldcnodes=oldname||'.'||oldnumbers
  386. call close(f)
  387. call delay(14)
  388. end
  389. end i
  390. InDir="Inbound:"
  391. InboundFiles=showdir(InDir,'F')
  392. DO i=1 TO WORDS(InboundFiles)
  393. testfile=WORD(InboundFiles,i)
  394. line=testfile
  395. parse var line newname '.' newnumbers rest
  396. if upper(newname)='CLINKLST' THEN
  397. do
  398. trap=1
  399. setclip('c','ClinkLST')
  400. newcname=getclip('c')
  401. newcfile=InDir||newname||'.'||newnumbers
  402. newcnodes=newname||'.'||newnumbers
  403. address command 'copy' newcfile 'to nodelist:'
  404. end
  405. end i
  406. call delay(14)
  407. close(f)
  408. RETURN
  409. checkclinkeco:
  410. InDir="Nodelist:"
  411. InboundFiles=showdir(InDir,'F')
  412. DO i=1 TO WORDS(InboundFiles)
  413. testfile=WORD(InboundFiles,i)
  414. line=testfile
  415. parse var line oldname '.' oldnumbers rest
  416. if upper(oldname)='CLINKECO' THEN
  417. do
  418. oldname='ClinkECO'
  419. oldcefile=InDir||oldname||'.'||oldnumbers
  420. oldechos=oldname||'.'||oldnumbers
  421. call close(f)
  422. call delay(14)
  423. end
  424. end i
  425. InDir="Inbound:"
  426. InboundFiles=showdir(InDir,'F')
  427. DO i=1 TO WORDS(InboundFiles)
  428. testfile=WORD(InboundFiles,i)
  429. line=testfile
  430. parse var line newname '.' newnumbers rest
  431. if upper(newname)='CLINKECO' THEN
  432. do
  433. newname='ClinkECO'
  434. newfile=InDir||newname||'.'||newnumbers
  435. newechos=newname||'.'||newnumbers
  436. address command 'copy' newfile 'to nodelist:'
  437. if ticpath="0" then call delete(newfile)
  438. call delay(14)
  439. filename='sysdata:log/maint'
  440. if ~exists(filename) then
  441. do
  442. call open(f,filename,'w')
  443. end
  444. call open(f,filename,'a')
  445. line=''
  446. call writeln(f,line)
  447. line='Deleted' oldechos 'and copied' newechos 'to Nodelist: on' Date(u) 'at' Time(c)
  448. call writeln(f,line)
  449. line=''
  450. call writeln(f,line)
  451. call close(f)
  452. call delete(oldcefile)
  453. end
  454. end i
  455. call delay(14)
  456. RETURN
  457. checkfaithlst:
  458. newfaname=''
  459. InDir="Nodelist:"
  460. InboundFiles=showdir(InDir,'F')
  461. DO i=1 TO WORDS(InboundFiles)
  462. testfile=WORD(InboundFiles,i)
  463. line=testfile
  464. parse var line oldname '.' oldnumbers rest
  465. if upper(oldname)='FAITHLST' THEN
  466. do
  467. oldfaname='FaithLST'
  468. oldfafile=InDir||oldname||'.'||oldnumbers
  469. oldfanodes=oldname||'.'||oldnumbers
  470. call close(f)
  471. call delay(14)
  472. end
  473. end i
  474. InDir="Inbound:"
  475. InboundFiles=showdir(InDir,'F')
  476. DO i=1 TO WORDS(InboundFiles)
  477. testfile=WORD(InboundFiles,i)
  478. line=testfile
  479. parse var line newname '.' newnumbers rest
  480. if upper(newname)='FAITHLST' THEN
  481. do
  482. trap=1
  483. setclip('fa','FaithLST')
  484. newfaname=getclip('fa')
  485. newfafile=InDir||newname||'.'||newnumbers
  486. newfanodes=newname||'.'||newnumbers
  487. address command 'copy' newfafile 'to nodelist:'
  488. end
  489. end i
  490. call delay(14)
  491. close(f)
  492. RETURN
  493. checkfaitheco:
  494. InDir="Nodelist:"
  495. InboundFiles=showdir(InDir,'F')
  496. DO i=1 TO WORDS(InboundFiles)
  497. testfile=WORD(InboundFiles,i)
  498. line=testfile
  499. parse var line oldname '.' oldnumbers rest
  500. if upper(oldname)='FAITHECO' THEN
  501. do
  502. oldname='FaithECO'
  503. oldfile=InDir||oldname||'.'||oldnumbers
  504. oldechos=oldname||'.'||oldnumbers
  505. call close(f)
  506. call delay(14)
  507. end
  508. end i
  509. InDir="Inbound:"
  510. InboundFiles=showdir(InDir,'F')
  511. DO i=1 TO WORDS(InboundFiles)
  512. testfile=WORD(InboundFiles,i)
  513. line=testfile
  514. parse var line newname '.' newnumbers rest
  515. if upper(newname)='FAITHECO' THEN
  516. do
  517. newname='FaithECO'
  518. newfile=InDir||newname||'.'||newnumbers
  519. newechos=newname||'.'||newnumbers
  520. address command 'copy' newfile 'to nodelist:'
  521. if ticpath="0" then call delete(newfile)
  522. call delay(14)
  523. filename='sysdata:log/maint'
  524. if ~exists(filename) then
  525. do
  526. call open(f,filename,'w')
  527. end
  528. call open(f,filename,'a')
  529. line=''
  530. call writeln(f,line)
  531. line='Deleted' oldechos 'and copied' newechos 'to Nodelist: on' Date(u) 'at' Time(c)
  532. call writeln(f,line)
  533. line=''
  534. call writeln(f,line)
  535. call close(f)
  536. call delete(oldfile)
  537. end
  538. end i
  539. call delay(14)
  540. RETURN
  541.